#! /bin/sh

echo "Extracting ircd/version.c ..."

srcdir=$1

if test -r version.c
then
   generation=`sed -n 's/^const char \*generation = \"\(.*\)\";/\1/p' < version.c`
   if test ! "$generation" ; then generation=0; fi
else
   generation=0
fi

generation=`expr $generation + 1`

creation=`date | \
awk '{if (NF == 6) \
	 { print $1 " " $2 " " $3 " " $6 " at " $4 " " $5 } \
else \
	 { print $1 " " $2 " " $3 " " $7 " at " $4 " " $5 " " $6 }}'`

cvs_version=`cat ../ChangeLog.nefarious | grep '#define CVS_VERSION "$Id:' | \
awk '{ print $5 " " $6 }'`

/bin/cat >version.c <<!SUB!THIS!
/*
 * IRC - Internet Relay Chat, ircd/version.c
 * Copyright (C) 1990 Chelsea Ashley Dyerman
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

/*
 * This file is generated by version.c.SH. Any changes made will go away.
 */

#include "version.h"
#include "patchlevel.h"

const char *generation = "$generation";
const char *creation = "$creation";
const char *cvs_version = "$cvs_version";
const char *version = BASE_VERSION RELEASE PATCHLEVEL;

const char *infotext[] = {
    "IRC --",
    "This program is free software; see LICENSE in the distribution",
    "-",
    "Based on the original code written by Jarkko Oikarinen, version 2.6:",
    "Wiz          Jarkko Oikarinen         <jto@tolsun.oulu.fi>",
    "-",
    "The main developer of version u2.9 and u2.10 was:",
    "Run          Carlo Wood               <carlo@runaway.xs4all.nl>",
    "-",
    "The head developer of the u2.10 source tree was:",
    "Bleep        Thomas Helvey            <tomh@inxpress.net>",
    "-",
    "The current maintainers of the u2.10 source tree are:",
    "Isomer       Perry Lorier             <perry@coders.net>",
    "Kev          Kevin L. Mitchell        <klmitch@mit.edu>",
    "-",
    "Contributors to this release:",
    "Kev, Isomer, Gte, Ghostwolf, Bleep",
    "Debugging and support:",
    "SeKs, Maniac-, HeKTik, OmniDynmc, Liandrin, Dianora",
    "Special thanks to Angel and Buff for believing in us and putting",
    "up with frantic late night phone calls",
    "-",
    "Head developers of Nefarious (evilnet development):",
    "[http://sourceforge.net/projects/evilnet/]",
    "reed         Reed Loden               <reed@reedloden.com>",
    "Math         Mathieu Rene             <math@rootservices.net>",
    "SiRVulcaN    Neil Spierling           <sirvulcan@sirvulcan.co.nz>",
    "Rubin        Alex Schumann            <rubin@afternet.org>",
    "-",
    "Other contributors to Nefarious:",
    "ULtimaTe_    Matthias Crauwels        <ultimate_@wol.be>",
    "Spike        Jochen Meesters          <spike@undernet.org>",
    "clsk         Alan Alvarez             <clsk@users.sourceforge.net>",
    "-",
    "Nefarious infamous testers:",
    "Rubin (AfterNET), CaptKirk\` (Protium), Proto",
    "-",
    "Thanks goes to all other people who contributed to any version.",
    "A full listing of all coders can be found in doc/Authors in the",
    "source.",
    0
};


const char *othertext[] = {
    "-",
    "Sources:",
!SUB!THIS!

cvs_version=`cat ../ChangeLog.nefarious | grep '#define CVS_VERSION "$Id:' | \
awk '{ print $5 " " $6 }'`

( for file in ${srcdir}/ircd/*.[cly] ${srcdir}/ircd/version.c.SH ; do
    case `basename $file` in
      version.c | y.tab.c | lex.yy.c | chattr.tab.c ) ;;
      * ) echo $file ;;
    esac done ) | ./umkpasswd -5 >> version.c

echo "    \"\"," >> version.c
echo "    \"Headers:\"," >> version.c

( for file in ${srcdir}/include/*.h ; do echo $file ; done ) | ./umkpasswd -5 >> version.c

/bin/cat >>version.c <<!SUB!THIS!
    0,
};

const char *copyrighttext[] = {
    "Nefarious IRCu is copyright (C) 2002-2008 by the past and present developers",
    "of Nefarious IRCu. Refer to the documentation within doc/Authors and README for",
    "full credits and copyrights. An archive containing this documentation and",
    "Nefarious IRCu can be obtained from http://sourceforge.net/projects/evilnet/",
    "Nefarious IRCu is a derivative of the Undernet IRCu daemon, which can found at:",
    "http://coder-com.undernet.org/, and is also licensed under the GNU GPL.",
    "-",
    "This program is free software; you can redistribute it and/or modify",
    "it under the terms of the GNU General Public License as published by",
    "the Free Software Foundation; either version 3, or (at your option)",
    "any later version.",
    "-",
    "This program is distributed in the hope that it will be useful,",
    "but WITHOUT ANY WARRANTY; without even the implied warranty of",
    "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the",
    "GNU General Public License for more details.",
    "-",
    "A copy of the GNU General Public License is distributed alongside all",
    "official releases of Nefarious IRCu. It can also be obtained by writing to",
    "Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA",
    0,
};

!SUB!THIS!
